package com.xz;

/**
 * @author XZ
 * @create 2021-06-06 20:59
 */
public class Person implements Comparable<com.xz.Person> {
    private int age;
    private String name;

    public Person(int age, String name) {
        this.age = age;
        this.name = name;
    }

    public Person(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public int compareTo(com.xz.Person e) {//实现比较接口方法
        return age-e.age;
    }

    @Override
    public String toString() {
        return age + "," + name;
    }
}